/**
 * Copyright 2008-2009 HAN.BIFANG
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */
package han.bashe.common.message;

import han.bashe.common.util.CommonUtils;


/**
 * @Author Kent
 */
public class RequestHelper {
	
	private NormalizedMessage msg = null;

	
	public RequestHelper() {
		msg = new NormalizedMessage();
	}

	
	public RequestHelper(NormalizedMessage msg) {
		this.msg = msg;
	}

	
	public NormalizedMessage getMessage() {
		return msg;
	}

	
	
	
	public String getConversationId() {
		return msg.getHead(MessageHeaderConstants.HEAD_CON_ID);
	}

	
	public void setConversationId(String conversationId) {
		msg.setHead(MessageHeaderConstants.HEAD_CON_ID, conversationId);
	}

	
	
	public String getReplyServiceCode() {
		return msg.getHead(MessageHeaderConstants.HEAD_REPLY_SERVICE_CODE);
	}

	
	public void setReplyServiceCode(String code) {
		msg.setHead(MessageHeaderConstants.HEAD_REPLY_SERVICE_CODE, code);
	}

	
	public String getServiceCode() {
		return msg.getHead(MessageHeaderConstants.HEAD_SERVICE_CODE);
	}

	
	public void setServiceCode(String serviceCode) {
		msg.setHead(MessageHeaderConstants.HEAD_SERVICE_CODE, serviceCode);
	}

	
	public String getUserLoginId() {
		return msg.getHead(MessageHeaderConstants.HEAD_USER_ID);
	}

	
	public void setUserLoginId(String userLoginId) {
		msg.setHead(MessageHeaderConstants.HEAD_USER_ID, userLoginId);
	}
	
	public String getOrginMsgType() {
		return msg.getHead(MessageHeaderConstants.HEAD_ORGIN_MSG_TYPE);
	}

	
	public void setOrginMsgType(String type) {
		msg.setHead(MessageHeaderConstants.HEAD_ORGIN_MSG_TYPE, type);
	}
	
	public String getMethod() {
		return msg.getHead(MessageHeaderConstants.HEAD_METHOD);
	}

	
	public void setMethod(String m) {
		msg.setHead(MessageHeaderConstants.HEAD_METHOD, m);
	}

	
	
	
	public String getBusCode() {
		return msg.getHead(MessageHeaderConstants.HEAD_BUS_CODE);
	}

	
	public void setBusCode(String s) {
		msg.setHead(MessageHeaderConstants.HEAD_BUS_CODE, s);
	}

	
	public String getBusCon() {
		return msg.getHead(MessageHeaderConstants.HEAD_BUS_CON);

	}

	public void setBusCon(String con) {
		msg.setHead(MessageHeaderConstants.HEAD_BUS_CON, con);

	}

	public String getRetryLogId() {

		return msg.getHead(MessageHeaderConstants.HEAD_RETRY_LOG_ID);
	}

	public void setRetryLogId(String logId) {

		msg.setHead(MessageHeaderConstants.HEAD_RETRY_LOG_ID, logId);
	}
	
	
	public Boolean isRetryData() {

		String s = msg.getHead(MessageHeaderConstants.HEAD_RETRY_DATA);
		if(CommonUtils.isEmpty(s))
			return false;
		return Boolean.parseBoolean(s);
	}

	public void setRetryData(Boolean v) {

		msg.setHead(MessageHeaderConstants.HEAD_RETRY_DATA, v.toString());
	}

	public String getLogId() {

		return msg.getHead(MessageHeaderConstants.HEAD_LOG_ID);
	}

	public void setLogId(String id) {

		msg.setHead(MessageHeaderConstants.HEAD_LOG_ID, id);
	}

	public String getServiceVersion() {
		return msg.getHead(MessageHeaderConstants.HEAD_SERVICE_VERSION);
	}

	public void setServiceVersion(String version) {
		msg.setHead(MessageHeaderConstants.HEAD_SERVICE_VERSION, version);
	}

	public String getReplyServiceVersion() {
		return msg.getHead(MessageHeaderConstants.HEAD_REPLY_SERVICE_VERSION);
	}

	public void setReplyServiceVersion(String version) {
		msg.setHead(MessageHeaderConstants.HEAD_REPLY_SERVICE_VERSION, version);
	}
	
	
	public String getWebServicesInputParam() {
		return msg.getHead(MessageHeaderConstants.HEAD_WEB_SERVICES_INPUT_PARAM);
	}

	public void setWebServicesInputParam(String param) {
		msg.setHead(MessageHeaderConstants.HEAD_WEB_SERVICES_INPUT_PARAM, param);
	}
	
	
	public String getUserPassword() {
		return msg.getHead(MessageHeaderConstants.HEAD_USER_PASSWORD);
	}

	public void setUserPassword(String param) {
		msg.setHead(MessageHeaderConstants.HEAD_USER_PASSWORD, param);
	}
	
	public String getRequestId() {
		return msg.getHead(MessageHeaderConstants.HEAD_REQUEST_ID);
	}

	public void setRequestId(String param) {
		msg.setHead(MessageHeaderConstants.HEAD_REQUEST_ID, param);
	}
	
	public String getApplication() {
		return msg.getHead(MessageHeaderConstants.HEAD_APPLICATION);
	}

	public void setApplication(String param) {
		msg.setHead(MessageHeaderConstants.HEAD_APPLICATION, param);
	}
	
	public String getNotifyService() {
		return msg.getHead(MessageHeaderConstants.HEAD_NOTIFY_SERVICE);
	}

	
	public void setNotifyService(String s) {
		msg.setHead(MessageHeaderConstants.HEAD_NOTIFY_SERVICE, s);
	}
	
	public String getNotifyServiceVersion() {
		return msg.getHead(MessageHeaderConstants.HEAD_NOTIFY_SERVICE_VERSION);
	}

	
	public void setNotifyServiceVersion(String s) {
		msg.setHead(MessageHeaderConstants.HEAD_NOTIFY_SERVICE_VERSION, s);
	}
	
	
	public void setCustomHead(String name, String value) {
		msg.setHead(name, value);
	}

	
	public String getCustomHead(String name) {
		return msg.getHead(name);
	}

	
	public void setBody(String b) {
		msg.setBody(b);
	}

	
	public String getBody() {
		return msg.getBody();
	}

	
	public String removeLogId() {
		return msg.removeHead(MessageHeaderConstants.HEAD_LOG_ID);
	}
	
	public String removeReplyServiceCode(){
		return msg.removeHead(MessageHeaderConstants.HEAD_REPLY_SERVICE_CODE);	
	}
	
	
	public String removeReplyServiceVersion(){
		return msg.removeHead(MessageHeaderConstants.HEAD_REPLY_SERVICE_VERSION);	
	}
	
	
	
	
	public String removeBusCon(){
		return msg.removeHead(MessageHeaderConstants.HEAD_BUS_CON);	
	}
	
	public String removeRetryLogId(){
		return msg.removeHead(MessageHeaderConstants.HEAD_RETRY_LOG_ID);	
	}
	
	
	
	
}
